<?php
	include 'conexao.php';
	
	$texto = $_POST['texto_video'];
	$video = $_POST['link_video'];
	
	if($_GET['funcao']=="gravar"){
		
		$sql = mysql_query("insert into videos (texto, video) values ('$texto', '$video')");
		header("location: index.php?pg=videos"); 
	}
	if($_GET['funcao']=="alterar"){
		$id = $_GET['id'];
		$sql = mysql_query("update videos set texto = '$texto', video = '$video' where id=$id");
		header("location: index.php?pg=videos");
	}
	if($_GET['funcao']=="excluir"){
		$id = $_GET['id'];
		$sql = mysql_query("delete from videos where id=$id");
		header("location: index.php?pg=videos");
	}
?>